<!DOCTYPE html>
<html lang="zh">
    <head>
        <title>${(attribute.title)!category.name}</title>
        <meta name="keywords" content="${(attribute.keywords)!}"/>
        <meta name="description" content="${(attribute.description)!}"/>
        <@_includePlace path="/8ddab9ba-a8aa-4745-86c6-66bf1c2c976c.html"/> <#-- header -->
    </head>
    <body>
        <@_includePlace path="/c32a4f4a-ff5d-49cf-bb59-5d9784539174.html"/> <#-- 导航 -->
        <div class="banner-l2 position-relative d-flex align-items-center justify-content-center">
            <div class="container text-center position-relative py-3 py-md-4">
                <div class="display-3 fw-bolder">${category.name}</div>
                <p class="text-secondary m-0">${(attribute.description)!}</p>
                <#if category.parentId?has_content>
                    <#assign attribute=getCategoryAttribute(category.parentId)/>
                </#if>
                <img src="${getAbsoluteUrl(site.sitePath,attribute.left_image)!}" class="position-absolute bottom-0" style="left: 8%;height: ${attribute.left_height!}%;">
                <img src="${getAbsoluteUrl(site.sitePath,attribute.right_image)!}" class="position-absolute bottom-0" style="right: 8%;height: ${attribute.right_height!}%;">
            </div>
        </div>

        <@import path="/ftl/tools.ftl" namespace="t"/><#-- 工具 -->
        <div class="container">
            <div class="row">
                <div class="col-12 d-flex justify-content-center my-5">
                    <ul class="nav nav-pills nav-l2">
                    <@_category id=category.parentId!category.id>
                        <li class="nav-item">
                            <a class="nav-link<#if object.id=category.id> active</#if>" aria-current="page" href="${object.url!}">全部</a>
                        </li>
                    </@_category>
                    <@_categoryList parentId=category.parentId!category.id>
                        <#list page.list as a>
                        <li class="nav-item">
                            <a class="nav-link<#if a.id=category.id> active</#if>" <#if a.onlyUrl> target="_blank"</#if> href="${a.url}">${a.name!}</a>
                        </li>
                        </#list>
                    </@_categoryList>
                    </ul>
                </div>
            </div>

            <div class="row justify-content-between">
                <@_contentList categoryId=category.id containChild=category.containChild pageIndex=pageIndex pageSize=category.pageSize>
                <div class="col-md-7 mb-5 mb-md-0">
                    <header class="tab-header fs-5">
                        <b class="pb-2">全部文章</b>
                    </header>
                    <div class="article-list">
                        <#list page.list as a>
                            <@t.merge 'categoryIds' a.categoryId/>
                        </#list>
                        <@_category ids=t.categoryIds!><#assign categoryMap=map!/></@_category>
                        <#list page.list as a>
                        <a href="${a.url}" <#if a.onlyUrl> target="_blank"</#if> class="d-block">
                            <div class="card flex-md-row align-items-start">
                                <div class="text-white bg-${['primary','purple','success'][a.categoryId%3]} fs-8 px-2 py-1 flex-shrink-0">
                                    ${categoryMap[a.categoryId?string].name}
                                </div>
                                <div class="card-body py-3 py-md-0 px-0 px-md-3">
                                    <h5 class="text-body">${a.title}</h5>
                                    <p class="fs-7 text-secondary text-break">${a.description!}</p>
                                    <footer class="fs-8 text-secondary text-opacity-50 d-flex align-items-center">
                                        <span class="me-4 d-inline-flex align-items-center"><img src="${site.sitePath}assets/img/icon-calendar.svg" alt="publish date">${a.publishDate?date}</span>
                                        <span class="me-4 d-inline-flex align-items-center"><img src="${site.sitePath}assets/img/icon-view.svg" alt="clicks">${a.clicks}</span>
                                        <span class="me-4 d-inline-flex align-items-center"><img src="${site.sitePath}assets/img/icon-comment.svg" alt="comments">${a.comments}</span>
                                    </footer>
                                </div>
                            </div>
                        </a>
                        </#list>
                    </div>
                    <ul class="pagination mt-5 overflow-auto pb-3">
                        <li class="page-item">
                            <a class="page-link" href="${getPage(url,page.prePage)}" aria-label="Previous">
                                <span aria-hidden="true">«</span>
                            </a>
                        </li>
                        <#assign start=1/>
                        <#if (page.pageIndex-5) gt start>
                            <#assign start=page.pageIndex-4/>
                        </#if>
                        <#assign end=page.totalPage/>
                        <#if (page.pageIndex+5) lt end>
                            <#assign end=page.pageIndex+4/>
                        </#if>
						<#if start gt 1>
							<li class="page-item"><a class="page-link" href="${getPage(url,1)}">1</a></li>
							<li class="page-item"><span>...</span></li>
						</#if>
                        <#list start..end as a>
                        <li class="page-item<#if a=page.pageIndex> active</#if>"><a class="page-link" href="${getPage(url,a)}">${a}</a></li>
                        </#list>
						<#if end lt page.totalPage>
						<li class="page-item"><span>...</span></li>
						<li class="page-item"><a class="page-link" href="${getPage(url,page.totalPage)}">${page.totalPage}</a></li>
						</#if>
                        <li class="page-item">
                            <a class="page-link" href="${getPage(url,page.nextPage)}" aria-label="Next">
                                <span aria-hidden="true">»</span>
                            </a>
                        </li>
                    </ul>
                </div>
                </@_contentList>
                <div class="col-md-4">
                    <@_includePlace path="/49d393ca-f0f1-4723-a9b0-6f9b6d7cc04d.html"/> <#-- 编辑推荐 -->
                    <header class="tab-header fs-5">
                        <b class="pb-2">热门文章</b>
                    </header>
                    <@_contentList categoryId=category.id containChild=true orderField='clicks' count=10>
                    <div class="list-group list-group-flush article-list-side py-2 fs-7">
                        <#list page.list as a>
                        <a href="${a.url!}" class="list-group-item">${a.title}</a>
                        </#list>
                    </div>
                    </@_contentList>
					<@_includePlace path="/17fbfe62-4fbe-4987-93d5-85383ebc5aa4.html"/> <#-- 最新投票 -->
					<@_includePlace path="/3fefc879-2ef2-448d-909f-dc31849bcf29.html"/> <#-- 最新调查问卷 -->
                </div>
            </div>
        </div>
        <script>
            var itemString="itemType=category&itemId=${category.id}";
        </script>
        <@_includePlace path="/7f8bacb5-30ca-4641-b66f-987d447b1a85.html"/> <#-- footer -->
    </body>
</html>